package com.zork.data.generator.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zork.data.generator.mapper.CmdbTopoMapper;
import com.zork.data.generator.model.CmdbTopo;
import com.zork.data.generator.model.DataMap;
import com.zork.data.generator.service.CmdbTopoService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author xiesen
 */
@Service
public class CmdbTopoServiceImpl extends ServiceImpl<CmdbTopoMapper, CmdbTopo> implements CmdbTopoService {
    @Override
    public List<CmdbTopo> searchByApp(String apps) {
        List<String> list = new ArrayList<>();
        if (StrUtil.isNotBlank(apps)) {
            final String[] array = apps.split(",");
            list = Arrays.asList(array);
        }
        return this.list(Wrappers.lambdaQuery(CmdbTopo.class).in(CmdbTopo::getWHZMC, list));
    }
}
